<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});


Route::group(['prefix' => 'admin'], function () {
    Route::auth();
});

Route::group(['prefix' => 'admin', 'namespace' => 'Admin','middleware' => 'auth'], function () {
    Route::get('/', 'IndexController@index');

});

Route::group(['namespace' => 'Admin', 'prefix' => 'admin','middleware' => 'auth'], function () {
    //用户管理
    Route::post('upload', 'CustomerController@upload');

    Route::group([ 'prefix' => 'customer'], function () {
        Route::post('add_customer', 'CustomerController@add_customer');
        Route::post('add_task', 'CustomerController@add_task');
        Route::post('ok', 'CustomerController@ok');
        Route::post('edit_task', 'CustomerController@edit_task');
    });
    Route::resource('customer', 'CustomerController');

});
Route::group(['namespace' => 'Admin', 'prefix' => 'admin','middleware' => 'auth'], function () {
    //用户管理
    Route::resource('task', 'TaskController');

});

Route::get('/home', 'HomeController@index');
